Fix. FW. Improve statement on WAF module to prevent false positive. - #710
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces PHPUnit coverage around WAF::hasSignature() to ensure “catch-all” body signatures (e.g., #.*#) don’t trigger unless constrained by headers/URL, helping reduce WAF false positives.
Changes:
- Added a new test suite validating that unconstrained catch-all body regex signatures do not match.
- Added positive/negative tests for header-constrained catch-all signatures.
- Added tests ensuring non-catch-all signatures (narrow regex / literal strings) still match as expected.
Suppressed comments (1)
tests/lib/CleantalkSP/SpbctWP/Firewall/WAFHasSignatureTest.php:61
- These new tests assert that a catch-all body regexp like
#.*#must not match whenwaf_headers/waf_urlare empty. However, the current implementation ofWAF::hasSignature()returnstrueas soon as the body matches andwhatToCheckAdditionally(...)returns'nothing'(seelib/CleantalkSP/SpbctWP/Firewall/WAF.php:422-425). As-is, this test will fail unless the corresponding production logic change is included in this PR.
public function testCatchAllWithoutHeadersDoesNotMatch()
{
$signature = array(
'body' => '#.*#',
'waf_headers' => null,
'waf_url' => null,
);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Glomberg
added a commit
that referenced
this pull request
Aug 17, 2026
* Mod. Settings. Moving Vulnerability Check settings to React * Mod. Settings. Moving Admin Bar settings to React * Fix jest config, add test for settings * Jest test for firewall and scanner * Mod. Settings. Moving Miscellaneous settings to React * fix php, js test errors * fix php, js test errors * New. UserPassCheck. Debugging functionality using the cron task launch button * Mod. UserPassCheck. Rendering the status of the check and its results * Fix js eslint errors, upd common libs * Fix. FW. Improve logs. * Mod. PSCTab. Caching data for fast content display * Upd. Settings. Add BFP option. (#694) * Upd. Settings. Add BFP option. * make desc dinamic * fix cp * fix cp * Upd. Firewall. Improve BFP module to protect woo login. (#693) * Upd. Firewall. Improve BFP module to protect woo login. * upd * fix cp * fix cp * fix psalm * fix cp * fix cp * Security Firewall UI update https://app.doboard.com/1/task/38882 * Upd version 2.185.99-dev * Upd version 2.185.99-fix * UI update. Renamed the account creation button and description. Add new params in request https://app.doboard.com/1/task/53201 * Fix. Scan. Improve surface iterator to filter not available dirs. (#705) * Fix. Scan. Improve surface iterator to filter not available dirs. * fix cp * Upd. Scan. Update skip policy. (#704) * Upd. Scan. Update skip policy. * fix cp * Mod. PSCTab. Filtering by installed plug-ins, PC search, active PSC filtering * Fix. PSCTab. Editing the caching logic and general output in accordance with the available cache data * Fix. Integrations. Update upload checker verify from ACF. * Fix. PSCTab. Edits for the formation of values for the total number of PSCs, edits for comments * Fix. Scan. Show unknown accordion. (#709) * Fix. Scan. Show unknown accordion. * fix cp * File synchronization https://app.doboard.com/1/task/38991 * Fix. Remote Calls. Wrong response fixed. (#707) * Mod. Settings. Transferring settings to React * Fix. FW. Improve statement on WAF module to prevent false positive. (#710) * Fix. FW. Improve statement on WAF module to prevent false positive. * upd * Fix errors * Jest test * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix copilot review * Sync branch * Fix eslint * Fix. Settings. Refactoring and deleting old code * Fix. Settings. Improve curl wrapper. * Fix. Settings. Auto cure setting fixed. * Fix. Admin banners. Critical files banner fixed. (#712) * Version: 2.186 and changelog updated. * Fix. Readme. WP 7.1 compatibility added. * Upd. Readme. Changelog updated. * Upd. Readme. Changelog updated. * Fix. Code. Bundle rebuilt. * Fix. Upload checker. Check files during meadia uploading fixed. (#713) * Fix. Code. Unused code removed. * Upd. Readme. Changelog updated. --------- Co-authored-by: AntonV1211 <antonV1211@yandex.ru> Co-authored-by: svfcode <svfcode@mail.ru> Co-authored-by: Aleksandr Banins <alexander.b@cleantalk.org> Co-authored-by: AntonV1211 <39616556+AntonV1211@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
task https://app.doboard.com/1/task/54874#comment_351988